package io;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class ISRDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("osw.txt");
        InputStreamReader isr = new InputStreamReader(fis,"UTF-8");
        /*
          int read()
          读取一个字符，返回的int实际上是一个char。但如果返回的int对应的整数为-1则
          表示流读取到了末尾。
         */
        int d;
        while((d=isr.read()) != -1) {
            System.out.println((char) d);
        }
        isr.close();
    }
}
